#SIMW LIBRARY CMAKE OPTIONS
#########################################################

SET(PTMW_Applet "SE050_E" CACHE STRING "The Secure Element Applet")
SET_PROPERTY(CACHE PTMW_Applet PROPERTY STRINGS "SE05X_A;SE05X_B;SE05X_C;SE051_H;AUTH;SE050_E")

SET(PTMW_SE05X_Ver "07_02" CACHE STRING "SE05X Applet version.")
SET_PROPERTY(CACHE PTMW_SE05X_Ver PROPERTY STRINGS "03_XX;07_02")

SET(PTMW_HostCrypto "None" CACHE STRING "Counterpart Crypto on Host")
SET_PROPERTY(CACHE PTMW_HostCrypto PROPERTY STRINGS "MBEDTLS;OPENSSL;None;")

SET(PTMW_SE05X_Auth "None" CACHE STRING "SE050 Authentication")
SET_PROPERTY(CACHE PTMW_SE05X_Auth PROPERTY STRINGS "None;UserID;PlatfSCP03;AESKey;ECKey;UserID_PlatfSCP03;AESKey_PlatfSCP03;ECKey_PlatfSCP03;"
)

OPTION(WithCodeCoverage "Compile with Code Coverage" OFF)

#########################################################

IF("${PTMW_Applet}" STREQUAL "SE05X_A")
    SET(SSS_HAVE_APPLET_SE05X_A "1")
ELSE()
    SET(SSS_HAVE_APPLET_SE05X_A "0")
ENDIF()

IF("${PTMW_Applet}" STREQUAL "SE05X_B")
    SET(SSS_HAVE_APPLET_SE05X_B "1")
ELSE()
    SET(SSS_HAVE_APPLET_SE05X_B "0")
ENDIF()

IF("${PTMW_Applet}" STREQUAL "SE05X_C")
    SET(SSS_HAVE_APPLET_SE05X_C "1")
ELSE()
    SET(SSS_HAVE_APPLET_SE05X_C "0")
ENDIF()

IF("${PTMW_Applet}" STREQUAL "SE051_H")
    SET(SSS_HAVE_APPLET_SE051_H "1")
ELSE()
    SET(SSS_HAVE_APPLET_SE051_H "0")
ENDIF()

IF("${PTMW_Applet}" STREQUAL "AUTH")
    SET(SSS_HAVE_APPLET_AUTH "1")
ELSE()
    SET(SSS_HAVE_APPLET_AUTH "0")
ENDIF()

IF("${PTMW_Applet}" STREQUAL "SE050_E")
    SET(SSS_HAVE_APPLET_SE050_E "1")
ELSE()
    SET(SSS_HAVE_APPLET_SE050_E "0")
ENDIF()

#########################################################

IF("${PTMW_SE05X_Ver}" STREQUAL "03_XX")
    SET(SSS_HAVE_SE05X_VER_03_XX "1")
ELSE()
    SET(SSS_HAVE_SE05X_VER_03_XX "0")
ENDIF()

IF("${PTMW_SE05X_Ver}" STREQUAL "07_02")
    SET(SSS_HAVE_SE05X_VER_07_02 "1")
ELSE()
    SET(SSS_HAVE_SE05X_VER_07_02 "0")
ENDIF()

#########################################################

IF("${PTMW_HostCrypto}" STREQUAL "MBEDTLS")
    SET(SSS_HAVE_HOSTCRYPTO_MBEDTLS "1")
ELSE()
    SET(SSS_HAVE_HOSTCRYPTO_MBEDTLS "0")
ENDIF()

IF("${PTMW_HostCrypto}" STREQUAL "OPENSSL")
    SET(SSS_HAVE_HOSTCRYPTO_OPENSSL "1")
ELSE()
    SET(SSS_HAVE_HOSTCRYPTO_OPENSSL "0")
ENDIF()

IF("${PTMW_HostCrypto}" STREQUAL "None")
    SET(SSS_HAVE_HOSTCRYPTO_NONE "1")
ELSE()
    SET(SSS_HAVE_HOSTCRYPTO_NONE "0")
ENDIF()

#########################################################

SET(SSS_HAVE_SCP_NONE "1")
SET(SSS_HAVE_SCP_SCP03_SSS "0")

IF("${PTMW_SE05X_Auth}" STREQUAL "None")
    SET(SSS_HAVE_SE05X_AUTH_NONE "1")
ELSE()
    SET(SSS_HAVE_SE05X_AUTH_NONE "0")
    SET(SSS_HAVE_SCP_NONE "0")
    SET(SSS_HAVE_SCP_SCP03_SSS "1")
    SET(SSSFTR_SE05X_AuthSession "1")
ENDIF()

IF("${PTMW_SE05X_Auth}" STREQUAL "UserID")
    SET(SSS_HAVE_SE05X_AUTH_USERID "1")
ELSE()
    SET(SSS_HAVE_SE05X_AUTH_USERID "0")
ENDIF()

IF("${PTMW_SE05X_Auth}" STREQUAL "PlatfSCP03")
    SET(SSS_HAVE_SE05X_AUTH_PLATFSCP03 "1")
ELSE()
    SET(SSS_HAVE_SE05X_AUTH_PLATFSCP03 "0")
ENDIF()

IF("${PTMW_SE05X_Auth}" STREQUAL "AESKey")
    SET(SSS_HAVE_SE05X_AUTH_AESKEY "1")
ELSE()
    SET(SSS_HAVE_SE05X_AUTH_AESKEY "0")
ENDIF()

IF("${PTMW_SE05X_Auth}" STREQUAL "ECKey")
    SET(SSS_HAVE_SE05X_AUTH_ECKEY "1")
ELSE()
    SET(SSS_HAVE_SE05X_AUTH_ECKEY "0")
ENDIF()

IF("${PTMW_SE05X_Auth}" STREQUAL "UserID_PlatfSCP03")
    SET(SSS_HAVE_SE05X_AUTH_USERID_PLATFSCP03 "1")
ELSE()
    SET(SSS_HAVE_SE05X_AUTH_USERID_PLATFSCP03 "0")
ENDIF()

IF("${PTMW_SE05X_Auth}" STREQUAL "AESKey_PlatfSCP03")
    SET(SSS_HAVE_SE05X_AUTH_AESKEY_PLATFSCP03 "1")
ELSE()
    SET(SSS_HAVE_SE05X_AUTH_AESKEY_PLATFSCP03 "0")
ENDIF()

IF("${PTMW_SE05X_Auth}" STREQUAL "ECKey_PlatfSCP03")
    SET(SSS_HAVE_SE05X_AUTH_ECKEY_PLATFSCP03 "1")
ELSE()
    SET(SSS_HAVE_SE05X_AUTH_ECKEY_PLATFSCP03 "0")
ENDIF()

#########################################################

# Below values are not included in cmake options to keep the selection simple
# Values are kept to have feature file similar to standard package
SET(SSS_HAVE_MBEDTLS_ALT_NONE "1")
SET(SSS_HAVE_FIPS_NONE "1")
SET(SSS_HAVE_SBL_NONE "1")
SET(SSS_HAVE_A71CH_AUTH_NONE "1")
SET(SSSFTR_SE05X_AES "1")
SET(SSSFTR_SE05X_ECC "1")
SET(SSSFTR_SE05X_RSA "1")
SET(SSSFTR_SE05X_KEY_SET "1")
SET(SSSFTR_SE05X_KEY_GET "1")
SET(SSSFTR_SE05X_AuthECKey "1")
SET(SSSFTR_SE05X_CREATE_DELETE_CRYPTOOBJ "1")
SET(SSSFTR_SW_AES "1")
SET(SSSFTR_SW_ECC "1")
SET(SSSFTR_SW_RSA "1")
SET(SSSFTR_SW_KEY_SET "1")
SET(SSSFTR_SW_KEY_GET "1")
SET(SSSFTR_SW_TESTCOUNTERPART "1")
SET(SSS_HAVE_ECC "1")
SET(SSS_HAVE_RSA "1")
SET(SSS_HAVE_EC_ED "1")
SET(SSS_HAVE_TPM_BN "1")
SET(SSS_HAVE_EC_MONT "1")
SET(SSS_HAVE_TLS_HANDSHAKE "1")
SET(SSS_HAVE_IMPORT "1")
SET(SSS_HAVE_MIFARE_DESFIRE "1")
SET(SSS_HAVE_PBKDF2 "1")

IF("${PTMW_Applet}" STREQUAL "SE050_E")
    SET(SSSFTR_SE05X_RSA "0")
    SET(SSS_HAVE_RSA "0")
ENDIF()

SET(SSS_HAVE_SE_RESET_LOGIC_1 "1")

#########################################################
IF(WithCodeCoverage)
    IF(CMAKE_COMPILER_IS_GNUCXX)
        INCLUDE(${SIMW_LIB_DIR}/scripts/jenkins/scripts/utils/CodeCoverage.cmake)
        APPEND_COVERAGE_COMPILER_FLAGS()
    ENDIF()
ENDIF()
#########################################################

CONFIGURE_FILE(${SIMW_LIB_DIR}/sss/inc/fsl_sss_ftr.h.in ${SIMW_LIB_DIR}/fsl_sss_ftr.h)
